package com.handu.luna.core.domain.user;


import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.handu.luna.core.domain.BaseRepository;



public interface UserRankRepository extends JpaRepository<UserRank,Long>, BaseRepository<UserRank>,JpaSpecificationExecutor<UserRank>{
	
	@Query("from UserRank r  where r.rankName = :rankName AND r.id <> :id")
	public List<UserRank> findRankNameExist(@Param("rankName") String rankName,@Param("id") long id);
	
	@Query("from UserRank r  order by id asc")
	List<UserRank> findAll();
	
	@Query("from UserRank r  where r.isSpecial = true order by id asc")
	List<UserRank> findAllSpecial();
	
	@Query("from UserRank r  where r.isSpecial = false  order by id asc")
	List<UserRank> findAllNotSpecial();


}